package com.zmc.third.controller;

import com.zmc.common.constant.CacheConstants;
import com.zmc.common.domain.vo.third.SmsVo;
import com.zmc.common.utils.R;
import com.zmc.common.utils.redis.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @Author：zmc
 * @Date：2024/12/3 16:23
 */

@RestController
@RequestMapping("/sms")
public class SMSController {

    @Autowired
    private RedisCache redisCache;

    /**
     * 发送短信，暂不对接
     * todo 数据暂存到third服务中，后期将code存到各自服务
     * */
    @PostMapping("send/code")
    public R sendCode(@RequestBody SmsVo vo){
        redisCache.setCacheObject(CacheConstants.SMS_CODE_MEMBER_KEY + vo.getPhone(), "123456", 60, TimeUnit.SECONDS);
        return R.ok();
    }

}
